<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

<html><head>

<style type="text/css">
  body {
    border: 10px solid #5e8ba6;
    padding:5px;
  	background-color: #3a3836;
  	color: #e9e1bc;
  	font-size:1.5em;
  }
  .header {
  	font-size:0.8em;
  }
  a:visited { color: #e6d05e; }
  a:hover { color: #835141; background-color:#e6d05e; }
  a { color: #e6d05e; height:50px; text-decoration:none; }
  
</style>


<title>shopular.</title></head></html>
<body>
<div class="header">
<%@ page import="org.springframework.context.ApplicationContext, dk.ihk.shopular.services.UserService, org.springframework.web.servlet.support.RequestContextUtils" %> 
<%
	ApplicationContext context = RequestContextUtils.getWebApplicationContext(request);
	UserService userService = (UserService) context.getBean("userService");
	if (userService.validAuthentication(request)) {
		//okay
		out.println("You are now in, " + request.getSession().getAttribute("user") + "!");
		out.println("<a href='/shopular/user/logout.do'>Logout</a>");
		
	} else {
		//not okay
		String redirectURL = "/shopular/user/login.do";
	    response.sendRedirect(redirectURL);
	}
%>
</div>
<h1>shopular.</h1>
<div style="width:100%; background-color:#5e8ba6; height:10px;">&nbsp;</div>